﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Impresion;
using System.Drawing.Printing;
using SIGEB.Modelo.moduloEstadisticas;

namespace SIGEB.Prototipo.Vista.moduloEstadisticas
{
    public partial class frm_VistaGrafico : frm_Base
    {
        #region CONSTRUCTOR

        public frm_VistaGrafico(SIGEB.Prototipo.Control.controlPrincipal cp):base(cp)
        {
            InitializeComponent();
            asignarUI(this.Controls);
        }

        #endregion

        #region EVENTOS

        public override void hacerVisible(object[] arg)
        {
            if (arg != null)
            {
                try
                {
                    documento = new graficoImprimible((ChartStyle)arg[0], (DataCollection)arg[1], (DataSeries)arg[2], (LinkedList<datoEstadistico>)arg[3], (Size)arg[4], (Panel)arg[5]);
                    impresion = new Impresiones(documento.GetWidth(), documento.GetHeight());
                    impresion.agregarDocumentoImpresion(documento);
                    impresion.visualizarBoleta(printPreviewControl1);
                    printPreviewControl1.Zoom = 1;
                    BringToFront();
                }catch(Exception e){
                    mostrarInfo("Argumentos inválidos. " + e.Message);
                }
            }
        }

        private void btn_Confirmar_Click(object sender, EventArgs e)
        {
            if(impresion != null)
                impresion.imprimirDocumentos();
        }

        #endregion

        #region METODOS
        #endregion

        #region ATRIBUTOS

        private graficoImprimible documento;
        private Impresiones impresion;

        #endregion
    }
}
